feat(meta): add spec-validator tool#336
Conversation
…ody sections
Adds tools/spec-validator/, a stdlib-only uv tool analogous to
tools/skill-validator/ that validates every .md file carrying a YAML
frontmatter block in tools/spec-loop/specs/:
1. Required frontmatter keys (title, status, kind, mode, source, acceptance)
2. Valid status / kind / mode values
3. Non-empty acceptance list
4. Required body sections (What it does, Where it lives,
Behaviour & contract, Out of scope, Acceptance criteria, Validation)
5. Validation section contains at least one fenced code block
Files without frontmatter (README.md, overview.md) are silently skipped.
56 tests pass; 11 live specs from the control branch validate clean.
Note: all 7 IMPLEMENTATION_PLAN.md items were found to be merged or
in-flight before this iteration; this item was derived from the Known
gap in specs/meta-and-quality-tooling.md ("a spec validator analogous
to the skill validator"). A plan/update beat should reconcile.
Generated-by: Claude (Opus 4.7)
The capability-sync check from apache#340 requires every tool with a `**Capability:**` declaration to carry a row in `docs/labels-and-capabilities.md`, and every tool README to declare its capability. `tools/spec-validator/README.md` predates the rule; add the line (matches sibling meta tools — `skill-and-tool-validator`, `spec-loop` — at `capability:setup`) and the corresponding table row. Also fix a stale ref in the README: `tools/skill-validator/` → `tools/skill-and-tool-validator/` (renamed in apache#340). Generated-by: Claude Code (Opus 4.7)
potiuk
left a comment
There was a problem hiding this comment.
LGTM — clean stdlib-only validator analogous to skill-and-tool-validator on
the spec side. 7 validation rules (required frontmatter keys, enum values
for status/kind/mode, non-empty acceptance, required body sections,
fenced code block in Validation), and a hand-rolled YAML-lite parser
that correctly skips files lacking frontmatter (README.md, overview.md)
and tolerates the SPDX HTML-comment header that prefixes every spec.
Verified locally
- 57 tests pass (
uv run --project tools/spec-validator --group dev pytest). - Tool runs cleanly against the live specs (
spec-validator: OK (no violations))
viauv run --project tools/spec-validator spec-validate. skill-and-tool-validateexits 0 across the repo after the fixup commit
(no hard violations).
Fixup landed on top of your commit
Added a small chore: commit to satisfy the capability-sync check from
#340 that the PR predated:
tools/spec-validator/README.md— added**Capability:** capability:setup
(matches sibling meta tools —skill-and-tool-validator,spec-loop).docs/labels-and-capabilities.md— added the corresponding tool-table
row.- Also fixed a stale ref in the README:
tools/skill-validator/→
tools/skill-and-tool-validator/(renamed in #340).
This review was drafted by an AI-assisted tool and confirmed by an Apache Steward
maintainer. The maintainer approving this PR has read the findings and signed off.
If something feels off, please reply on the PR and a maintainer will follow up.More on how Apache Steward handles maintainer review:
CONTRIBUTING.md.
CodeQL flagged two unused names in `tests/test_spec_validator.py`: - unused imports `REQUIRED_FRONTMATTER_KEYS` and `validate_file` - unused local variable `text` in `test_missing_code_block` (left over from an earlier draft; the test already uses `spec_no_code` for the actual assertion) Remove all three. Ruff clean; 57 tests still pass. Generated-by: Claude Code (Opus 4.7)
Summary
validate spec frontmatter and b…ody sections
Adds tools/spec-validator/, a stdlib-only uv tool analogous to tools/skill-validator/ that validates every .md file carrying a YAML frontmatter block in tools/spec-loop/specs/:
Files without frontmatter (README.md, overview.md) are silently skipped. 56 tests pass; 11 live specs from the control branch validate clean.
Note: all 7 IMPLEMENTATION_PLAN.md items were found to be merged or in-flight before this iteration; this item was derived from the Known gap in specs/meta-and-quality-tooling.md ("a spec validator analogous to the skill validator"). A plan/update beat should reconcile.
Generated-by: Claude (Opus 4.7)
Summary
Type of change
.claude/skills/<name>/) — eval fixtures updated belowtools/<system>/*.md)tools/*/withpyproject.toml)docs/,README.md,CONTRIBUTING.md)projects/_template/)prek, workflows, validators)Test plan
prek run --all-filespassesuv run pytest/ruff check/mypypasses(
PYTHONPATH=tools/skill-evals/src python3 -m skill_evals.runner tools/skill-evals/evals/<skill>/)(a regression test for the bug fixed / the behaviour added — see CONTRIBUTING.md)